package cn.laixueit.cart.controller;

import cn.laixueit.cart.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("/upload")
@CrossOrigin
public class UploadCotroller {

    @Autowired
    private UploadService uploadService;

    @PostMapping("/image")
    public @ResponseBody String img(@RequestParam MultipartFile file){
        String filePath =  uploadService.upload(file);
        return filePath;
    }

}
